<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>标段承接确认</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="shortcut icon" href="../../../favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="../../../static/css/font.css">
    <link rel="stylesheet" href="../../../static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../../../static/css/buildUnit/common.css">

</head>
<body>
<div class="content">
    <div class="layui-tab" lay-filter="demo">
        <ul class="layui-tab-title" id="orgTypeView" lay-filter="orgType">
            <script type="text/html" id="orgType">
                {{# layui.each(d.list, function(index, item){ }}
                <li lay-id="{{item.checkType}}" class="{{d.currentType===item.checkType?'layui-this':''}}">
                    {{item.checkTypeName}}部门意见详情
                </li>
                {{# }); }}
            </script>
        </ul>
        <div class="layui-tab-content tabel-fold">
            <table id="klmyTable" lay-filter="klmyTable"></table>
        </div>
    </div>
</div>
<script src="../../../static/js/main.js"></script>
<script>
    //Demo
    layui.use([
        'jquery',
        'configureCom',
        'configure',
        'element',
        'suggest',
        'element',
        'templateInit',
        'sessionFun',
        'bluebird',
        'table',
        'jsDictFile',
        'matchDict'
    ], function () {
        var $ = layui.jquery;
        var configureCom = layui.configureCom;
        var configure = layui.configure;
        var suggest = layui.suggest;
        var templateInit = layui.templateInit;
        var sessionFun = layui.sessionFun;
        var element = layui.element;
        var table = layui.table;
        var jsDictFile = layui.jsDictFile;
        var matchDict = layui.matchDict;
        var expertData = sessionFun.get(configure.SESSION_EXPERT_DATA);
        var drawData = sessionFun.get(configure.SESSION_DRAWING_DATA);
        //获取单位工程下机构类型
        suggest.getOrg().then(function (res) {
            //第三步：渲染模版
            var data = { //数据
                currentType: expertData.checkType,
                "list": res.result
            };
            templateInit.init('orgTypeView', data, $('#orgType').html());
        });
        //意见列表请求参数
        var tableData = {
            adviseOrgType: expertData.checkType,   //部门类型
            singleProjectId: expertData.sgProjId,  //单位工程id
            speciatyId: drawData.speciatyId,           //专业id
            sgProjSpecExportId: expertData.sgProjSpecExportId
        };
        //意见请求url
        var url = configure.EXPERT_SPECITY_SUGGEST_HTTP;
        var cols = [[ //表头
            {
                field: 'drawingNo', title: '图号', templet: function (d) {
                    return '<p>' + d.drawingNo + '</p><p class="child-td">轮数：' + d.checkTimes + '</p>';
                }
            },
            {
                field: 'articleType', title: '条文性质', templet: function (d) {
                    var articleType = d.articleType ? matchDict.name(d.articleType, jsDictFile.adviseArticleType) : '-';
                    var qiangtiaoCode = d.qiangtiaoCode ? matchDict.name(d.qiangtiaoCode, jsDictFile.qiangtiaoCode) : '-';
                    if (d.articleType == 1020) {
                        return '<p>' + articleType + '</p><p class="child-td">强条类型：' + qiangtiaoCode + '</p>';
                    } else {
                        return articleType;
                    }
                }
            },
            {
                field: 'adviseTxt', title: '意见', templet: function (d) {
                    var replyTxt = d.replyTxt ? '<p>设计院回复：' + d.replyTxt + '</p>' : '';
                    return '<p>' + d.adviseTxt + '</p>' + replyTxt;
                }
            },
            {
                field: '', title: '专家', templet: function (d) {
                    var time = d.adviseAddTime ? configureCom.dateToStrAll(d.adviseAddTime) : '-';
                    return '<p>' + d.expertName + '</p><p class="child-td">' + time + '</p>';
                }
            }
        ]];
        //渲染表格
        configureCom.tableRender(url, tableData, cols);
        //一些事件监听
        element.on('tab(demo)', function (data) {
            tableData.adviseOrgType = $(data.elem['context']).attr('lay-id');
            configureCom.tableReload(false, tableData, configure.EXPERT_SPECITY_SUGGEST_HTTP);
        });
    });
</script>
</body>
</html>